home *** CD-ROM | disk | FTP | other *** search
- unit LibTestForm;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, LibIntf,
- StdCtrls, ExtCtrls, Tabs, Menus;
-
- type
- TLibExTest = class(TForm)
- TabSet1: TTabSet;
- Notebook1: TNotebook;
- GroupBox1: TGroupBox;
- Label1: TLabel;
- BaseReg: TEdit;
- GroupBox2: TGroupBox;
- Label6: TLabel;
- Label3: TLabel;
- DisplayGrid: TCheckBox;
- SnapToGrid: TCheckBox;
- ShowComponentCaptions: TCheckBox;
- GridSizeX: TEdit;
- GridSizeY: TEdit;
- GroupBox5: TGroupBox;
- ComboBox1: TComboBox;
- Image2: TImage;
- cbLockState: TCheckBox;
- Label5: TLabel;
- PathAndBaseName: TLabel;
- Label7: TLabel;
- AppHandle: TLabel;
- Label8: TLabel;
- IDETime: TLabel;
- Label9: TLabel;
- WinSize: TLabel;
- Label4: TLabel;
- Image1: TImage;
- GroupBox4: TGroupBox;
- Label2: TLabel;
- HelpClassName: TEdit;
- ClassHelpOK: TButton;
- GroupBox3: TGroupBox;
- ComboBox2: TComboBox;
- Label10: TLabel;
- Button1: TButton;
- procedure FormCreate(Sender: TObject);
- procedure HelpClassNameChange(Sender: TObject);
- procedure ClassHelpOKClick(Sender: TObject);
- procedure FormPaint(Sender: TObject);
- procedure TabSet1Change(Sender: TObject; NewTab: Integer;
- var AllowChange: Boolean);
- procedure ComboBox1Change(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- implementation
-
- {$R *.DFM}
-
- procedure TLibExTest.FormCreate(Sender: TObject);
- var
- r: TRect;
- Opts: TDesignerOptions;
- begin
- TabSet1.Tabs := NoteBook1.Pages;
-
- with DelphiIDE do begin
- BaseReg.Text := GetBaseRegKey;
- GetDesignerOptions (Opts);
- DisplayGrid.Checked := Opts.DisplayGrid;
- SnapToGrid.Checked := Opts.SnapToGrid;
- ShowComponentCaptions.Checked := Opts.ShowComponentCaptions;
- GridSizeX.Text := IntToStr (Opts.GridSizeX);
- GridSizeY.Text := IntToStr (Opts.GridSizeY);
- cbLockState.Checked := LockState;
- PathAndBaseName.Caption := GetPathAndBaseExeName;
- AppHandle.Caption := '$' + IntToHex (GetAppHandle, 8);
- IDETime.Caption := '$' + IntToHex (GetCurTime, 8);
- r := GetMainWindowSize;
- WinSize.Caption := Format ('(%d,%d)-(%d,%d)', [r.Left, r.Top, r.Right, r.Bottom]);
- ComboBox1.ItemIndex := 0;
- ComboBox2.ItemIndex := 0;
- ComboBox1Change (Self);
- end;
- end;
-
- procedure TLibExTest.HelpClassNameChange(Sender: TObject);
- begin
- ClassHelpOK.Enabled := HelpClassName.Text <> '';
- end;
-
- procedure TLibExTest.ClassHelpOKClick(Sender: TObject);
- begin
- DelphiIDE.ShowClassHelp (HelpClassName.Text);
- end;
-
- procedure TLibExTest.FormPaint(Sender: TObject);
- var
- Item: TIPaletteItem;
- begin
- with DelphiIDE do
- if GetToolSelected then begin
- Label4.Visible := True;
- Image1.Visible := True;
- Item := GetCurCompClass;
- try
- Item.Paint (Image1.Canvas, 0, 0);
- finally
- Item.Free;
- end;
- end
- else begin
- Label4.Visible := False;
- Image1.Visible := False;
- end;
- end;
-
- procedure TLibExTest.TabSet1Change (Sender: TObject; NewTab: Integer;
- var AllowChange: Boolean);
- begin
- NoteBook1.PageIndex := NewTab;
- end;
-
- procedure TLibExTest.ComboBox1Change(Sender: TObject);
- var
- Item: TIPaletteItem;
- Cls: TComponentClass;
- begin
- with DelphiIDE do begin
- case ComboBox1.ItemIndex of
- 0: Cls := TMainMenu;
- 1: Cls := TPopupMenu;
- 2: Cls := TLabel;
- 3: Cls := TEdit;
- 4: Cls := TMemo;
- 5: Cls := TButton;
- 6: Cls := TCheckBox;
- 7: Cls := TRadioButton;
- 8: Cls := TListBox;
- 9: Cls := TComboBox;
- 10: Cls := TScrollBar;
- 11: Cls := TGroupBox;
- 12: Cls := TRadioGroup;
- 13: Cls := TPanel;
- else Cls := Nil;
- end;
-
- if Cls = Nil then Image2.Visible := False else begin
- Item := GetPaletteItem (Cls);
- try
- Item.Paint (Image2.Canvas, 0, 0);
- finally
- Item.Free;
- end;
- Image2.Visible := True;
- Image2.Invalidate;
- end;
- end;
- end;
-
- procedure TLibExTest.Button1Click (Sender: TObject);
- begin
- { This will do nothing if there's no active form }
- DelphiIDE.ExecDesignDialog (TDesignDialog (ComboBox2.ItemIndex));
- end;
-
- end.
-
-
-
-
-
-
-